﻿using Sys.Core.Models.Dto;
using Sys.Core.Models.Queries;
using Sys.Core.Models.VO;
using MiniFox.Components;
using MiniFox.Infrastructure;
using MiniFox.Security.Text;

namespace Sys.Core.Providers
{
    [AutoRegister]
    public interface IUserProvider
    {
        #region 检查可用性
        /// <summary>
        /// 检查登录名是否已使用
        /// </summary>
        /// <param name="loginName">要检查的登录名</param>
        /// <param name="userId">要排除的userId</param>
        /// <returns></returns>
        bool IsUsedLoginName(string loginName, string userId = null);
        /// <summary>
        /// 检查注册邮箱是否已使用
        /// </summary>
        /// <param name="secEmail">要检查的注册邮箱</param>
        /// <param name="userId">要排除的userId</param>
        /// <returns></returns>
        bool IsUsedSecEmail(string secEmail, string userId = null);
        /// <summary>
        /// 检查注册手机号是否已使用
        /// </summary>
        /// <param name="cellphone">要检查的手机号</param>
        /// <param name="userId">要排除的userId</param>
        /// <returns></returns>
        bool IsUsedCellphone(string cellphone, string userId = null);
        #endregion

        #region user
        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<UserVo>> Query(PagedQueryObject<UserQuery> query);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        UserVo GetUser(string userId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        bool UpdateUser(UserDto user);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="password">初始密码</param>
        /// <returns></returns>
        bool CreateUser(UserDto user, Cipher password);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        RoleVo[] GetUserRoles(string userId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        bool ChangePassword(string userId, Cipher password);
        #endregion

        #region user config

        #endregion

        #region user profile

        #endregion

    }
}
